//
//  MineHomeTableViewCell.m
//  B2C
//
//  Created by 李小龙 on 2017/7/26.
//  Copyright © 2017年 lixiaolong. All rights reserved.
//

#import "MineHomeTableViewCell.h"

@implementation MineHomeTableViewCell
- (IBAction)allOrderButtonAction:(id)sender {
    if (self.block) {
        self.block();
    }
}

+ (instancetype)mineHomeCellWithTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath {
    NSInteger index = 0;
    NSString *identifier = @"";
    switch (indexPath.section) {
        case 0:
            index = 0;
            identifier = @"mineHomeFirstCellIdentifier";
            break;
        case 1:
            index = 1;
            identifier = @"mineHomeSecondCellIdentifier";
            break;
        default:
            break;
    }
    MineHomeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"MineHomeTableViewCell" owner:self options:nil] objectAtIndex:index];
        if (index == 0) {
            cell.redPointObligation.block = ^(NSInteger tag) {
                if (cell.redBlock) {
                    cell.redBlock(tag);
                }
            };
            cell.redPointReceived.block = ^(NSInteger tag) {
                if (cell.redBlock) {
                    cell.redBlock(tag);
                }
            };
            cell.redPointEvaluation.block = ^(NSInteger tag) {
                if (cell.redBlock) {
                    cell.redBlock(tag);
                }
            };
            cell.redPointRefunded.block = ^(NSInteger tag) {
                if (cell.redBlock) {
                    cell.redBlock(tag);
                }
            };
        }
    }
    return cell;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
